package com.github.soiff.shadow.plugin.calc;

/**
 * Created by Soiff on 2016/05/20.
 *
 * @author : Soiff
 */
public class Numbers {

    public Numbers() {
    }

    public static int compare(Object n1, Object n2) {
        if(n1 instanceof Number && n2 instanceof Number) {
            double d1 = ((Number)n1).doubleValue();
            double d2 = ((Number)n2).doubleValue();
            return d1 < d2?-1:(d1 == d2?0:1);
        } else {
            throw new IllegalArgumentException("not a number");
        }
    }
}
